package com.cqupt.utils;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Iterator;

public class FileReadMan implements Iterator<String>{
	private FileReader fileReader = null;
	private BufferedReader bufferedReader = null;
	private String curretnString = null;
	public FileReadMan(String path) {
		try {
			this.fileReader = new FileReader(path);
			this.bufferedReader = new BufferedReader(this.fileReader);
			this.curretnString = this.bufferedReader.readLine();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	public boolean hasNext() {
		if (null == curretnString) {
			return false;
		} else {
			return true;
		}
	}
	
	
	public String next() {
		String result = this.curretnString;
		try {
			this.curretnString = this.bufferedReader.readLine();
		} catch (IOException e) {
			e.printStackTrace();
		}
		return result;
	}
}
